//    Copyright (C) Kherty.  All rights reserved.
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using OpenLS.Chart.UI.Internals;

namespace OpenLS.Chart.UI
{
    public class ChartTemplateGrouping: GroupDescription
    {
        public override object GroupNameFromItem(object item, int level, System.Globalization.CultureInfo culture)
        {
            if (item is Column3DChartTemplate)
            {
                switch (((Column3DChartTemplate)item).Shape)
                {

                    case ChartShape.Box:
                        return UIStringTable.Column3D;
                    case ChartShape.Cone:
                    case ChartShape.ConeToMax:
                        return EnumTable.ChartShape_Cone;
                    case ChartShape.Pyramid:
                    case ChartShape.PyramidToMax:
                        return EnumTable.ChartShape_Pyramid;
                        case ChartShape.Cylinder:
                        return EnumTable.ChartShape_Cylinder;
                }
            }
            if (item is ColumnChartTemplate)
                return UIStringTable.Column2D;
            if (item is LineChartTemplate)
                return UIStringTable.Line2D;
            if (item is Line3DChartTemplate)
                return UIStringTable.Line3D;
            if (item is Bar3DChartTemplate)
            {
                switch (((Bar3DChartTemplate)item).Shape)
                {
                    case ChartShape.Box:
                        return UIStringTable.Bar3D;
                    case ChartShape.Cone:
                    case ChartShape.ConeToMax:
                        return EnumTable.ChartShape_Cone;
                    case ChartShape.Pyramid:
                    case ChartShape.PyramidToMax:
                        return EnumTable.ChartShape_Pyramid;
                    case ChartShape.Cylinder:
                        return EnumTable.ChartShape_Cylinder;
                }
            }
            if (item is BarChartTemplate)
                return UIStringTable.Bar2D;
            if (item is Area3DChartTemplate)
                return UIStringTable.Area3D;
            if (item is AreaChartTemplate)
                return UIStringTable.Area2D;
            if (item is Pie3DChartTemplate)
                return UIStringTable.Pie3D;
            if (item is PieChartTemplate)
                return UIStringTable.Pie2D;
            if (item is ScatterChartTemplate)
                return UIStringTable.Scatter;
            // Contract.Assert(false);
            return "NONE";
        }

    }
}
